/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Donnees;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author mizho
 */
@Entity
@Table(name = "ue")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Ue.findAll", query = "SELECT u FROM Ue u"),
    @NamedQuery(name = "Ue.findByIdue", query = "SELECT u FROM Ue u WHERE u.idue = :idue"),
    @NamedQuery(name = "Ue.findByCodeue", query = "SELECT u FROM Ue u WHERE u.codeue = :codeue")})
public class Ue implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 2147483647)
    @Column(name = "idue")
    private String idue;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 255)
    @Column(name = "codeue")
    private String codeue;
    @JoinColumn(name = "thematique", referencedColumnName = "idthematique")
    @ManyToOne
    private Thematique thematique;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "ue")
    private Collection<TdUe> tdUeCollection;

    public Ue() {
    }

    public Ue(String idue) {
        this.idue = idue;
    }

    public Ue(String idue, String codeue) {
        this.idue = idue;
        this.codeue = codeue;
    }

    public String getIdue() {
        return idue;
    }

    public void setIdue(String idue) {
        this.idue = idue;
    }

    public String getCodeue() {
        return codeue;
    }

    public void setCodeue(String codeue) {
        this.codeue = codeue;
    }

    public Thematique getThematique() {
        return thematique;
    }

    public void setThematique(Thematique thematique) {
        this.thematique = thematique;
    }

    @XmlTransient
    public Collection<TdUe> getTdUeCollection() {
        return tdUeCollection;
    }

    public void setTdUeCollection(Collection<TdUe> tdUeCollection) {
        this.tdUeCollection = tdUeCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idue != null ? idue.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Ue)) {
            return false;
        }
        Ue other = (Ue) object;
        if ((this.idue == null && other.idue != null) || (this.idue != null && !this.idue.equals(other.idue))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Donnees.Ue[ idue=" + idue + " ]";
    }
    
}
